<html>
<head><meta charset="utf-8"><title>Deprecating compare_and_swap · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Deprecating.20compare_and_swap.html">Deprecating compare_and_swap</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="185973094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Deprecating%20compare_and_swap/near/185973094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Deprecating.20compare_and_swap.html#185973094">(Jan 18 2020 at 01:15)</a>:</h4>
<p>Talking about deprecating stuff, I just remembered that we forgot to deprecate <code>compare_and_swap</code> after we added <code>compare_exchange</code> and <code>compare_exchange_weak</code>. This was back in ~1.12.0.</p>



<a name="186016738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Deprecating%20compare_and_swap/near/186016738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Deprecating.20compare_and_swap.html#186016738">(Jan 18 2020 at 23:42)</a>:</h4>
<p>IIRC we weren't super gung-ho about deprecating compare_and_swap quickly when stabilizing compare_exchange due to the added complexity of thinking about success and failure orderings, and then it fell out of mind.</p>



<a name="186049239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Deprecating%20compare_and_swap/near/186049239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> faern <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Deprecating.20compare_and_swap.html#186049239">(Jan 19 2020 at 18:02)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> <span class="user-mention" data-user-id="243558">@Steven Fackler</span>  Omg, <code>compare_and_swap</code> is supposed to be deprecated? And the docs don't even mention that <code>compare_exchange</code> + <code>compare_exchange_weak</code> are supposed to replace it. You have no idea how much time I have spent trying to figure out what the difference is and which one should be used in what case. Let's deprecate it immediately or at least update the docs :/</p>



<a name="186049251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Deprecating%20compare_and_swap/near/186049251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Deprecating.20compare_and_swap.html#186049251">(Jan 19 2020 at 18:03)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/31767#issuecomment-215903038" target="_blank" title="https://github.com/rust-lang/rust/issues/31767#issuecomment-215903038">https://github.com/rust-lang/rust/issues/31767#issuecomment-215903038</a></p>



<a name="186049252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Deprecating%20compare_and_swap/near/186049252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Deprecating.20compare_and_swap.html#186049252">(Jan 19 2020 at 18:03)</a>:</h4>
<p>I'm going to split this off to a different topic</p>



<a name="217499855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Deprecating%20compare_and_swap/near/217499855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> faern <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Deprecating.20compare_and_swap.html#217499855">(Nov 21 2020 at 12:29)</a>:</h4>
<p>Necroing an old thread here. But I went ahead and submitted a PR for the deprecation of <code>compare_and_swap</code>: <a href="https://github.com/rust-lang/rust/pull/79261">https://github.com/rust-lang/rust/pull/79261</a>. Maybe the libs team don't want this any longer. But I could not find any information that explicitly said to not do the deprecation that is part of the accepted RFC after all.</p>



<a name="217500242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Deprecating%20compare_and_swap/near/217500242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Deprecating.20compare_and_swap.html#217500242">(Nov 21 2020 at 12:40)</a>:</h4>
<p>yeah it's probably good to clean that up. having both compare_and_swap and compare_exchange[_weak] does make things confusing.</p>



<a name="218103856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Deprecating%20compare_and_swap/near/218103856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> faern <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Deprecating.20compare_and_swap.html#218103856">(Nov 27 2020 at 15:33)</a>:</h4>
<p>Is this blocked on something? Or are we just waiting for someone having enough time to review it?</p>



<a name="218105051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Deprecating%20compare_and_swap/near/218105051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Deprecating.20compare_and_swap.html#218105051">(Nov 27 2020 at 15:45)</a>:</h4>
<p>Looks like the change was already agreed upon a long time ago, so just waiting for review.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>